@extends('admin.main')
@section('content')
    <div class="daohang">
        <ul>
            <li>
                <button type="button" class="am-btn am-btn-default am-radius am-btn-xs">就诊人管理>
                </button>
            </li>
            <li>
                <button type="button" class="am-btn am-btn-default am-radius am-btn-xs">就诊人列表
                </button>
            </li>
        </ul>
    </div>
    <div class="admin-biaogelist">

        <div class="listbiaoti am-cf">
            <ul class="am-icon-flag on"> 就诊人管理</ul>
            {{--<dl class="am-icon-home" style="float: right;"> 当前位置：首页 ><a href="#">医师列表</a></dl>--}}
        </div>



        {{--<div class="am-btn-toolbars am-btn-toolbar am-kg am-cf">
            <ul>
                <form action="{{urlAdmin('member','getIndex')}}">
                    <li><input type="text" class="am-form-field am-input-sm am-input-xm" name="keywords" placeholder="关键词搜索" /></li>
                    <li><button type="submit" class="am-btn am-radius am-btn-xs am-btn-success" style="margin-top: -1px;">搜索</button></li>
                </form>
            </ul>
        </div>
--}}
        <div class="am-btn-toolbars am-btn-toolbar am-kg am-cf">
            <ul>
                <form action="{{urlAdmin('member','getIndex')}}">
                    <li>
                        <div class="am-btn-group am-btn-group-xs">
                            <select name="g_id" data-am-selected="{btnWidth: 120, btnSize: 'sm', btnStyle: 'default'}">
                                <option value="0" selected >用户类型(全部)</option>
                                <option value="1" >普通用户</option>
                                <option value="2" >普通会员</option>
                                <option value="3" >家庭会员</option>
                            </select>
                        </div>
                    </li>

                    <li style="margin-right: 0;">
                        <span class="tubiao am-icon-calendar"></span>
                        <input type="text" name="starttime" class="am-form-field am-input-sm am-input-zm  am-icon-calendar" placeholder="开始日期" data-am-datepicker="{theme: 'success',}"  readonly/>
                    </li>
                    <li style="margin-left: -4px;">
                        <span class="tubiao am-icon-calendar"></span>
                        <input type="text" name="endtime" class="am-form-field am-input-sm am-input-zm  am-icon-calendar" placeholder="结束日期" data-am-datepicker="{theme: 'success',}"  readonly/>
                    </li>

                    <li><input type="text" class="am-form-field am-input-sm am-input-xm" name="keywords" placeholder="关键词搜索" /></li>
                    <li><button type="submit" class="am-btn am-radius am-btn-xs am-btn-success" style="margin-top: -1px;">搜索</button></li>
                </form>
            </ul>
        </div>

        <form class="am-form am-g">
            <table width="100%" class="am-table am-table-bordered am-table-radius am-table-striped">
                <thead>
                <tr class="am-success" align="center">
                    <th class="table-id">ID</th>
                    <th class="table-title">真实姓名</th>
                    <th class="table-title">类型</th>
                    <th class="table-title">性别</th>
                    <th class="table-title" >手机</th>
                    {{--<th class="table-title" >余额</th>--}}
                    <th class="table-id" style="width: 20%;">生日</th>
                    {{--<th class="table-title" >与用户关系</th>--}}
                    <th class="table-id" style="width: 20%;">就诊卡绑定状态</th>
                    <th class="table-id" style="width: 20%;">注册时间</th>
                    <th width="163px" class="table-set" style="width: 9%;">操作</th>
                </tr>
                </thead>
                <tbody>
                @if(!empty($data['data']))
                @foreach($data['data'] as $row)
                    <tr id="tr_{{$row['id']}}">
                    <td>{{$row['id']}}</td>
                    <td>{{$row['name']}}</td>
                    <td>@if($row['user']['group_id']==1) 普通用户 @elseif($row['user']['group_id']==2) 普通会员 @else 家庭会员 @endif </td>
                    <td>@if($row['sex']==1)男 @elseif($row['sex']==0)女 @else 不详 @endif</td>
                    <td>{{$row['mobile']}}</td>
                    {{--<td>198.88</td>--}}
                    <td>{{date("Y-m-d",strtotime($row['birthday']))}}</td>
                    {{--<td>{{$row['relation']}}</td>--}}
                    <td>@if(isset($row['card']['card_no'])){{$row['card']['card_no']}} @else 未绑定! @endif </td>
                    <td>{{$row['created_at']}}</td>
                    <td><div class="am-btn-toolbar">
                            <div class="am-btn-group am-btn-group-xs">
                                {{--<button class="am-btn am-btn-default am-btn-xs am-text-success am-round"><span class="am-icon-search"></span></button>--}}
              <!--编辑 -->          <a href="{{url('center/member/edit-member?id='.$row['id'])}}" class="am-btn am-btn-default am-btn-xs am-text-secondary am-round"><span class="am-icon-pencil-square-o"></span></a>
                                {{--<button class="am-btn am-btn-default am-btn-xs am-text-warning  am-round"><span class="am-icon-copy"></span></button>--}}
              <!--删除 -->          {{--<a href="{{url('center/member/del-member?id='.$row['id'])}}" onclick= "return confirm('确定删除?');" class="am-btn am-btn-default am-btn-xs am-text-danger am-round"><span class="am-icon-trash-o"></span></a>--}}
                                   <a href="javascript:void(0)" onclick="del({{$row['id']}})" class="am-btn am-btn-default am-btn-xs am-text-danger am-round"><span class="am-icon-trash-o"></span></a>
                            </div>
                        </div>
                    </td>
                    </tr>
                @endforeach
                @else
                    <tr>
                        <td colspan="8" style="text-align: center"><span>暂无数据~</span></td>
                    </tr>
                @endif
                </tbody>
            </table>

            <ul class="am-pagination am-fr">
                @if(isset($data['prev_page_url']))
                    <li><a href="{{$data['prev_page_url']}}">«</a></li>
                @endif
                @foreach($data['pageNoList'] as $v)
                    @if($data['current_page']==$v)
                        <li class="am-active"><a href="{{urlAdmin('member','getIndex')}}?page={{$v}}">{{$v}}</a></li>
                    @else
                        <li><a href="{{urlAdmin('member','getIndex')}}?page={{$v}}">{{$v}}</a></li>
                    @endif
                @endforeach
                    @if(isset($data['next_page_url']))
                        <li><a href="{{$data['next_page_url']}}">»</a></li>
                    @endif
            </ul>
            
            <hr />
        </form>

       @include('admin.footer')
        @section('script')
            <script>
                function del(id) {
                    layer.confirm('您确定要删除吗？', {
                        btn: ['确定', '取消'] //按钮
                    }, function () {
                        $.ajax({
                            type: "get",
                            url: "{{urlAdmin('member','getDelMember')}}?id=" + id,
                            dataType: "json",
                            success: function (res) {
                                if (res['state'] == 1) {
                                    layer.msg('删除成功', {icon: 6});
                                    $('#tr_'+id).hide();
                                } else {
                                    layer.msg('删除失败', {icon: 5});
                                }
                            }
                        })

                    });
                }
            </script>
        @endsection
@endsection